//
//  HomeLocationView.m
//  DingDongXiChe
//
//  Created by wtjr on 2018/1/4.
//  Copyright © 2018年 xieyingze. All rights reserved.
//

#import "HomeLocationView.h"

@interface HomeLocationView ()

@property (nonatomic, strong) BaseButton *locationButton;

@end

@implementation HomeLocationView

- (void)initData {
    self.backgroundColor = kCOLOR_white;
    self.layer.cornerRadius = kUI_LayerCorner;
    [self addSubview:self.locationButton];
}

- (void)initSubViews {
    [self addSubview:self.locationButton];
}

- (void)autoLayoutSubViews {
    [self.locationButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@15);
        make.centerX.equalTo(@0);
        make.width.height.equalTo(@30);
    }];
    [self setViewShadow:kCOLOR_shadow offset:CGSizeMake(0, 0) radius:kUI_ShawRadius];
}

- (void)bindViewModel {
    @weakify(self);
    [[self.locationButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        @strongify(self);
        [self.viewModel.updateLocationSubject sendNext:nil];
    }];
}

#pragma mark - BaseMethod


#pragma mark - Interface


#pragma mark - Delegate


#pragma mark - TouchEvent


#pragma mark - Setter


#pragma mark - Getter

- (BaseButton *)locationButton {
    if (!_locationButton) {
        _locationButton = [BaseButton new];
        _locationButton = [BaseButton new];
        _locationButton.imageName = @"dd_home_location";
        _locationButton.layer.anchorPoint = CGPointMake(0.5, 1);
        _locationButton.imageEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5);
    }
    return _locationButton;
}

@end
